package example03;

import java.awt.Color;

/**
 * @author grom
 */
public class NamedColor extends Color {
	public final static NamedColor AQUA        = new NamedColor(new Color(127, 255, 212), "aqua");
	public final static NamedColor BEIGE       = new NamedColor(new Color(245, 245, 220), "beige");
	public final static NamedColor BLACK       = new NamedColor(Color.black, "black");
	public final static NamedColor BLUE        = new NamedColor(new Color(0, 0, 222), "blue");
	public final static NamedColor EBLUE       = new NamedColor(Color.blue, "eblue");
	public final static NamedColor JFCBLUE     = new NamedColor(new Color(204, 204, 255), "jfcblue");
	public final static NamedColor JFCBLUE2    = new NamedColor(new Color(153, 153, 204), "jfcblue2");
	public final static NamedColor CYBERGREEN  = new NamedColor(Color.green.darker().brighter(), "cybergreen");
	public final static NamedColor DARKGREEN  = new NamedColor(new Color(0, 100, 75), "darkgreen");
	public final static NamedColor FORESTGREEN = new NamedColor(Color.green.darker(), "forestgreen");
	public final static NamedColor GRAY        = new NamedColor(Color.gray, "gray");
	public final static NamedColor GREEN       = new NamedColor(Color.green, "green");
	public final static NamedColor ORANGE      = new NamedColor(new Color(255, 165, 0), "orange");
	public final static NamedColor PURPLE      = new NamedColor(new Color(160, 32, 240),  "purple");
	public final static NamedColor RED         = new NamedColor(Color.red, "red");
	public final static NamedColor RUSTRED     = new NamedColor(Color.red.darker(), "rustred");
	public final static NamedColor SUNPURPLE   = new NamedColor(new Color(100, 100, 255), "sunpurple");
	public final static NamedColor SUSPECTPINK = new NamedColor(new Color(255, 105, 180), "suspectpink");
	public final static NamedColor TURQUOISE   = new NamedColor(new Color(0, 255, 255), "turquoise");
	public final static NamedColor VIOLET      = new NamedColor(new Color(238, 130, 238), "violet");
	public final static NamedColor YELLOW      = new NamedColor(Color.yellow, "yellow");	
	
    private String name;
    
    public NamedColor(Color color, String name) {
        super(color.getRGB());
        this.name = name;
    }

    public Color getTextColor() {
        int r = getRed();
        int g = getGreen();
        int b = getBlue();
        if (r > 240 || g > 240)
            return Color.black;
        else
            return Color.white;
    }

    public String toString() {
        return name;
    }
}
